﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Enterprise.Migrations
{
    public partial class 迁移剩余的表 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "HCD_MASTER",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    NAME = table.Column<string>(type: "VARCHAR(100)", nullable: true),
                    SEX = table.Column<string>(type: "VARCHAR(4)", nullable: true),
                    DATE_OF_BIRTH = table.Column<DateTime>(type: "DATETIME", nullable: false),
                    CHARGE_TYPE = table.Column<string>(type: "VARCHAR(8)", nullable: true),
                    DEPT_CODE = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    DEPT_NAME = table.Column<string>(type: "VARCHAR(40)", nullable: true),
                    BED_NO = table.Column<string>(type: "VARCHAR(8)", nullable: true),
                    BED_LABEL = table.Column<string>(type: "VARCHAR(8)", nullable: true),
                    DIAGNOSIS = table.Column<string>(type: "VARCHAR(500)", nullable: true),
                    PATIENT_CONDITION = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    VISIT_STATUS = table.Column<string>(type: "VARCHAR(10)", nullable: true),
                    DISCHARGE_TYPE = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    DOCTOR_IN_CHARGE = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    ADMISSION_DATE_TIME = table.Column<DateTime>(type: "DATETIME", nullable: false),
                    DISCHARGE_DATE_TIME = table.Column<DateTime>(type: "DATETIME", nullable: false),
                    MAILING_ADDRESS = table.Column<string>(type: "VARCHAR(100)", nullable: true),
                    PHONE_NUMBER = table.Column<string>(type: "VARCHAR(16)", nullable: true),
                    FOLLOW_UP_STATUS = table.Column<string>(type: "VARCHAR(5)", nullable: true),
                    FOLLOW_UP_GROUP = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    FOLLOW_UP_OPERATOR = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    REMOVE_MANAGEMENT = table.Column<string>(type: "VARCHAR(1)", nullable: true),
                    REMOVE_OPERATOR = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    REMOVE_DATE_TIME = table.Column<DateTime>(type: "DATETIME", nullable: false),
                    HOSPITAL_CODE = table.Column<string>(type: "VARCHAR(20)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_HCD_MASTER", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "HCD_MESSAGE",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    PATIENT_ID = table.Column<string>(type: "VARCHAR(10)", nullable: true),
                    VISIT_ID = table.Column<int>(type: "INT", nullable: false),
                    MESSAGE = table.Column<string>(type: "VARCHAR(200)", nullable: true),
                    MESSAGE_TIME = table.Column<DateTime>(type: "DATETIME", nullable: false),
                    MESSAGE_STATUS = table.Column<string>(type: "VARCHAR(2)", nullable: true),
                    MESSAGE_TYPE = table.Column<string>(type: "VARCHAR(10)", nullable: true),
                    MESSAGE_TYPE_NAME = table.Column<string>(type: "VARCHAR(40)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_HCD_MESSAGE", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "HCD_PAT_LABELS",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    PATIENT_ID = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    VISIT_ID = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    LABEL_TYPE_CODE = table.Column<string>(type: "VARCHAR(20)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_HCD_PAT_LABELS", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MANAGE_PARTING_DICT",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    PARTING_CODE = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    PARTING_NAME = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    INPUT_CODE = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    INPUT_CODE_WB = table.Column<string>(type: "VARCHAR(20)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MANAGE_PARTING_DICT", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MDT_COMMENTS",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    PATIENT_ID = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    VISIT_ID = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    MDT_ID = table.Column<long>(type: "BIGINT", nullable: false),
                    COMMENT = table.Column<string>(type: "TEXT", nullable: true),
                    CREATED_BY = table.Column<string>(type: "VARCHAR(2)", nullable: true),
                    CREATED_TIME = table.Column<DateTime>(type: "DATETIME", nullable: false),
                    UPDATED_TIME = table.Column<DateTime>(type: "TIMESTAMP", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MDT_COMMENTS", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MDT_GROUP",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    GROUP_TYPE = table.Column<string>(type: "VARCHAR(2)", nullable: true),
                    GROUP_NAME = table.Column<string>(type: "VARCHAR(30)", nullable: true),
                    DEPT_CODE = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    DEPT_NAME = table.Column<string>(type: "VARCHAR(40)", nullable: true),
                    MANAGE_TYPE = table.Column<string>(type: "VARCHAR(10)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MDT_GROUP", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MDT_GROUP_TYPE_DICT",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    GROUP_TYPE = table.Column<string>(type: "VARCHAR(40)", nullable: true),
                    GROUP_TYPE_NAME = table.Column<string>(type: "VARCHAR(40)", nullable: true),
                    INPUT_CODE = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    INPUT_CODE_WB = table.Column<string>(type: "VARCHAR(20)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MDT_GROUP_TYPE_DICT", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MDT_GROUP_USERS",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    GROUP_ID = table.Column<long>(type: "BIGINT", nullable: false),
                    DOCTOR_ID = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    DOCTOR_NAME = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    DOCTOR_DEPT = table.Column<string>(type: "VARCHAR(60)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MDT_GROUP_USERS", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MDT_MASTER",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    PATIENT_ID = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    VISIT_ID = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    SERIAL_NO = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    PRIORITY = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    PURPOSE = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    DESCRIPTION = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    STATUS = table.Column<int>(type: "INT", nullable: false),
                    GROUP_ID = table.Column<long>(type: "BIGINT", nullable: false),
                    CREATED_BY = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    CREATED_BY_NAME = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    CREATED_TIME = table.Column<DateTime>(type: "DATETIME", nullable: false),
                    END_TIME = table.Column<DateTime>(type: "DATETIME", nullable: false),
                    UPDATED_TIME = table.Column<DateTime>(type: "TIMESTAMP", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MDT_MASTER", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MDT_ORDERS",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    PATIENT_ID = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    VISIT_ID = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    MDT_ID = table.Column<long>(type: "BIGINT", nullable: false),
                    ORDER_NO = table.Column<int>(type: "INT", nullable: false),
                    ORDER_SUB_NO = table.Column<int>(type: "INT", nullable: false),
                    TEMPLATE_TYPE = table.Column<int>(type: "INT", nullable: false),
                    ORDER_CLASS = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    DRUG_CLASS = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    REPEAT_INDICATOR = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    ORDER_TEXT = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    ORDER_CODE = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    SPEC = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    DOSAGE = table.Column<decimal>(type: "DECIMAL", nullable: false),
                    DOSAGE_UNITS = table.Column<string>(type: "VARCHAR(8)", nullable: true),
                    FIRM_ID = table.Column<string>(type: "VARCHAR(30)", nullable: true),
                    FREQUENCY = table.Column<string>(type: "VARCHAR(16)", nullable: true),
                    ADMINISTRATION = table.Column<string>(type: "VARCHAR(16)", nullable: true),
                    DURATION = table.Column<int>(type: "INT", nullable: false),
                    DURATION_UNITS = table.Column<string>(type: "VARCHAR(4)", nullable: true),
                    FREQ_DETAIL = table.Column<string>(type: "VARCHAR(80)", nullable: true),
                    SUB_CLASS = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    EXAM_REASON = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    EXAMEPART = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    SPECIMEN = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    PERFORM_STATUS = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    PERFORM_ORDER_NO = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    CREATED_BY = table.Column<string>(type: "VARCHAR(2)", nullable: true),
                    CREATED_BY_NAME = table.Column<string>(type: "VARCHAR(60)", nullable: true),
                    CREATED_TIME = table.Column<DateTime>(type: "DATETIME", nullable: false),
                    UPDATED_TIME = table.Column<DateTime>(type: "TIMESTAMP", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MDT_ORDERS", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "PATIENT_PARTING_INFO",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    DEPT_CODE = table.Column<string>(type: "VARCHAR(40)", nullable: true),
                    PATIENT_TYPE = table.Column<string>(type: "VARCHAR(100)", nullable: true),
                    PARTING_CODE = table.Column<string>(type: "VARCHAR(45)", nullable: true),
                    BEFORE_MEAL_MIN = table.Column<decimal>(type: "DECIMAL", nullable: false),
                    BEFORE_MEAL_MAX = table.Column<decimal>(type: "DECIMAL", nullable: false),
                    BEFORE_MEAL_2H_MIN = table.Column<decimal>(type: "DECIMAL", nullable: false),
                    BEFORE_MEAL_2H_MAX = table.Column<decimal>(type: "DECIMAL", nullable: false),
                    HYPOGLYCEMIA_CRITICAL = table.Column<decimal>(type: "DECIMAL", nullable: false),
                    HYPERGLYCEMIA_CRITICAL = table.Column<decimal>(type: "DECIMAL", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PATIENT_PARTING_INFO", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "USER_SCREENING",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    SCREENING_NAME = table.Column<string>(type: "VARCHAR(45)", nullable: true),
                    SCREENING_USER = table.Column<string>(type: "VARCHAR(20)", nullable: true),
                    CONDITION_TYPE = table.Column<string>(type: "VARCHAR(1)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_USER_SCREENING", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "USER_SCREENING_DETAIL",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    SCREENING_NAME = table.Column<string>(type: "VARCHAR(45)", nullable: true),
                    CONTAIN_OR_NOT = table.Column<string>(type: "VARCHAR(1)", nullable: true),
                    SCREENING_VALUE = table.Column<string>(type: "VARCHAR(20)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_USER_SCREENING_DETAIL", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "HCD_MASTER");

            migrationBuilder.DropTable(
                name: "HCD_MESSAGE");

            migrationBuilder.DropTable(
                name: "HCD_PAT_LABELS");

            migrationBuilder.DropTable(
                name: "MANAGE_PARTING_DICT");

            migrationBuilder.DropTable(
                name: "MDT_COMMENTS");

            migrationBuilder.DropTable(
                name: "MDT_GROUP");

            migrationBuilder.DropTable(
                name: "MDT_GROUP_TYPE_DICT");

            migrationBuilder.DropTable(
                name: "MDT_GROUP_USERS");

            migrationBuilder.DropTable(
                name: "MDT_MASTER");

            migrationBuilder.DropTable(
                name: "MDT_ORDERS");

            migrationBuilder.DropTable(
                name: "PATIENT_PARTING_INFO");

            migrationBuilder.DropTable(
                name: "USER_SCREENING");

            migrationBuilder.DropTable(
                name: "USER_SCREENING_DETAIL");
        }
    }
}
